'''
窗体2
'''

import tkinter as tk
from tkinter import ttk
import sv_ttk


class MyWindow:
    def __init__(self, master):
        self.master = master
        master.title("A simple GUI")
        master.geometry('400x300')

        self.label = ttk.Label(master, text="This is our first GUI!")
        self.label.pack()
        self.entry = ttk.Entry(master)
        self.entry.pack()
        self.entry.insert(0,"请输入密码")

        self.button = ttk.Button(master, text="insert", command=self.insert)
        self.button.pack()
        self.button2 = ttk.Button(master, text="insert point", command=self.insert_point)
        self.button2.pack()
        self.button3 = ttk.Button(master, text="insert end", command=self.insert_end)
        self.button3.pack()


        self.close_button = ttk.Button(master, text="Close", command=master.quit)
        self.close_button.pack()

        self.text = tk.Text(master, height=10, width=30)
        self.text.pack()
        self.text.insert(tk.END, "Hello\n")
        self.text.insert(tk.END, "World\n")



    def greet(self):
        print("Greetings!")

    def insert(self):
        self.text.insert(tk.CURRENT,self.entry.get()+"\n")
        # self.entry.delete(0, tk.END)
        # self.entry.insert(0,"请输入密码")
    def insert_point(self):
        self.text.insert(tk.INSERT, self.entry.get()+"\n")
        # self.entry.delete(0, tk.END)
        # self.entry.insert(0,"请输入密码")

    def insert_end(self):
        self.text.insert(tk.END, self.entry.get()+"\n")

root = tk.Tk()
sv_ttk.set_theme("dark")
my_gui = MyWindow(root)
root.mainloop()
